import request from '@/utils/request'
import type {
  StoreListResponse,
  AddStoreParams,
  UpdateStoreParams,
  StoreResponse,
  DeleteStoreParams
} from './types/store'

// 查询门店列表
export async function getStoreList(): Promise<StoreListResponse> {
  return await request.get<StoreListResponse, StoreListResponse>("/shop/shop")
}

// 新增门店
export async function addStore(params: AddStoreParams): Promise<StoreResponse> {
  return await request.post<StoreResponse, StoreResponse>("/shop/shop", params)
}

// 修改门店
export async function updateStore(params: UpdateStoreParams): Promise<StoreResponse> {
  return await request.put<StoreResponse, StoreResponse>("/shop/shop", params)
}

// 删除门店
export async function deleteStore(params: DeleteStoreParams): Promise<StoreResponse> {
  return await request.delete<StoreResponse, StoreResponse>("/shop/shop", { data: params })
}